package com.kakarote.admin.controller;


import com.kakarote.admin.entity.PO.AdminLanguagePackRel;
import com.kakarote.admin.service.IAdminLanguagePackRelService;
import com.kakarote.core.common.Result;
import com.kakarote.core.feign.admin.entity.AdminLanguagePackRelAddBO;
import com.kakarote.core.feign.admin.entity.AdminLanguagePackRelBO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 语言包表 前端控制器
 * </p>
 *
 * @author zmj
 * @since 2020-12-01
 */
@RestController
@RequestMapping("/adminLanguagePackRel")
@Api(tags = "语言包关系相关接口")
public class AdminLanguagePackRelController {

    @Autowired
    private IAdminLanguagePackRelService iAdminLanguagePackRelService;

    @ApiOperation("查询字段语言包key列表")
    @PostMapping("/queryLanguagePackRelList")
    public Result<List<AdminLanguagePackRel>> queryLanguagePackRelList(@RequestBody AdminLanguagePackRelBO adminLanguagePackRelBO) {
        return Result.ok(iAdminLanguagePackRelService.queryLanguageKeyByBO(adminLanguagePackRelBO));
    }

    @ApiOperation("查询字段语言包key列表")
    @PostMapping("/addOrUpdateLanguagePack")
    public Result addOrUpdateLanguagePack(@RequestBody AdminLanguagePackRelAddBO relAddBO) {
        iAdminLanguagePackRelService.addOrUpdateLanguagePack(relAddBO);
        return Result.ok();
    }
}

